import React from 'react'
import { List } from 'antd-mobile';
import Rate from '../../components/rate'
import {get} from '../../axios'
import utils from '../../common/utils'

const Item = List.Item;
const Brief = Item.Brief;

class Assigned extends React.Component {
    constructor(props) {
        super(props)
        this.state = {
            users: [{user:{}}]
        }
    }

    componentDidMount() {
        const project_id = utils.getQueryString('project_id')
        this.get_list(project_id)
    }

    get_list = (project_id) => {
        get(`/mem/project-users/${project_id}`).then(
            res => {
                if (res.success) {
                    this.setState({users: res.data})
                }
            }
        )
    }

    render () {
        return (
            <div className='assigned'>
                <List>
                {
                    this.state.users.map( x => 
                        <Item
                        thumb={x.user.avatar}
                        multipleLine
                        // extra={'已拒绝'}
                        >
                        {x.user.nickname} 
                        <Brief>
                            <Rate
                                value={x.user.rank}
                                count={6}
                                disabled={true}
                            />
                        </Brief>
                        </Item>
                    )
                }
                   
                </List>
            </div>
        )
    }
}

export default Assigned